home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_emacs.idb / usr / freeware / info / emacs-4.z / emacs-4
Encoding:
GNU Info File  |  1998-10-28  |  46.8 KB  |  1,196 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.63 from the
  2. input file emacs.texi.
  3.  
  4. 
  5. File: emacs,  Node: M-x,  Next: Help,  Prev: Minibuffer,  Up: Top
  6.  
  7. Running Commands by Name
  8. ************************
  9.  
  10.    The Emacs commands that are used often or that must be quick to type
  11. are bound to keys--short sequences of characters--for convenient use.
  12. Other Emacs commands that do not need to be brief are not bound to
  13. keys; to run them, you must refer to them by name.
  14.  
  15.    A command name is, by convention, made up of one or more words,
  16. separated by hyphens; for example, `auto-fill-mode' or `manual-entry'.
  17. The use of English words makes the command name easier to remember than
  18. a key made up of obscure characters, even though it is more characters
  19. to type.
  20.  
  21.    The way to run a command by name is to start with `M-x', type the
  22. command name, and finish it with RET.  `M-x' uses the minibuffer to
  23. read the command name.  RET exits the minibuffer and runs the command.
  24. The string `M-x' appears at the beginning of the minibuffer as a
  25. "prompt" to remind you to enter the name of a command to be run.  *Note
  26. Minibuffer::, for full information on the features of the minibuffer.
  27.  
  28.    You can use completion to enter the command name.  For example, the
  29. command `forward-char' can be invoked by name by typing
  30.  
  31.      M-x forward-char RET
  32.  
  33. or
  34.  
  35.      M-x forw TAB c RET
  36.  
  37. Note that `forward-char' is the same command that you invoke with the
  38. key `C-f'.  You can run any Emacs command by name using `M-x', whether
  39. or not any keys are bound to it.  If you use `M-x' to run a command
  40. which also has a key binding, it displays a message to tell you about
  41. the key binding, before running the command.  (You can turn off this
  42. notification feature by setting the variable `suggest-key-bindings' to
  43. `nil'.)
  44.  
  45.    If you type `C-g' while the command name is being read, you cancel
  46. the `M-x' command and get out of the minibuffer, ending up at top level.
  47.  
  48.    To pass a numeric argument to the command you are invoking with
  49. `M-x', specify the numeric argument before the `M-x'.  `M-x' passes the
  50. argument along to the command it runs.  The argument value appears in
  51. the prompt while the command name is being read.
  52.  
  53.    If the command you type has a key binding of its own, Emacs mentions
  54. this in the echo area before it runs the command.  For example, if you
  55. type `M-x forward-word', the message says that you can run the same
  56. command more easily by typing `M-f'.  You can turn off these messages
  57. by setting `suggest-key-bindings' to `nil'.  If `suggest-key-bindings'
  58. is a number, it says how long to show the message before proceeding
  59. with the command.
  60.  
  61.    Normally, when describing a command that is run by name, we omit the
  62. RET that is needed to terminate the name.  Thus we might speak of `M-x
  63. auto-fill-mode' rather than `M-x auto-fill-mode RET'.  We mention the
  64. RET only when there is a need to emphasize its presence, such as when
  65. we show the command together with following arguments.
  66.  
  67.    `M-x' works by running the command `execute-extended-command', which
  68. is responsible for reading the name of another command and invoking it.
  69.  
  70. 
  71. File: emacs,  Node: Help,  Next: Mark,  Prev: M-x,  Up: Top
  72.  
  73. Help
  74. ****
  75.  
  76.    Emacs provides extensive help features accessible through a single
  77. character, `C-h'.  `C-h' is a prefix key that is used only for
  78. documentation-printing commands.  The characters that you can type after
  79. `C-h' are called "help options".  One help option is `C-h'; that is how
  80. you ask for help about using `C-h'.  To cancel, type `C-g'.  The
  81. function key F1 is equivalent to `C-h'.
  82.  
  83.    `C-h C-h' (`help-for-help') displays a list of the possible help
  84. options, each with a brief description.  Before you type a help option,
  85. you can use SPC or DEL to scroll through the list.
  86.  
  87.    `C-h' or F1 means "help" in various other contexts as well.  For
  88. example, in `query-replace', it describes the options available.  After
  89. a prefix key, it displays a list of the alternatives that can follow
  90. the prefix key.  (A few prefix keys don't support this because they
  91. define other meanings for `C-h'.)
  92.  
  93.    Most help buffers use a special major mode, Help mode, which lets you
  94. scroll conveniently with SPC and DEL.
  95.  
  96. * Menu:
  97.  
  98. * Help Summary::    Brief list of all Help commands.
  99. * Key Help::        Asking what a key does in Emacs.
  100. * Name Help::        Asking about a command, variable or function name.
  101. * Apropos::        Asking what pertains to a given topic.
  102. * Library Keywords::    Finding Lisp libraries by keywords (topics).
  103. * Misc Help::        Other help commands.
  104.  
  105. 
  106. File: emacs,  Node: Help Summary,  Next: Key Help,  Up: Help
  107.  
  108. Help Summary
  109. ============
  110.  
  111.    Here is a summary of the defined help commands.
  112.  
  113. `C-h a REGEXP RET'
  114.      Display list of commands whose names match REGEXP
  115.      (`apropos-command').
  116.  
  117. `C-h b'
  118.      Display a table of all key bindings in effect now, in this order:
  119.      minor mode bindings, major mode bindings, and global bindings
  120.      (`describe-bindings').
  121.  
  122. `C-h c KEY'
  123.      Print the name of the command that KEY runs
  124.      (`describe-key-briefly').  Here `c' stands for `character'.  For
  125.      more extensive information on KEY, use `C-h k'.
  126.  
  127. `C-h f FUNCTION RET'
  128.      Display documentation on the Lisp function named FUNCTION
  129.      (`describe-function').  Since commands are Lisp functions, a
  130.      command name may be used.
  131.  
  132. `C-h i'
  133.      Run Info, the program for browsing documentation files (`info').
  134.      The complete Emacs manual is available on-line in Info.
  135.  
  136. `C-h k KEY'
  137.      Display name and documentation of the command that KEY runs
  138.      (`describe-key').
  139.  
  140. `C-h l'
  141.      Display a description of the last 100 characters you typed
  142.      (`view-lossage').
  143.  
  144. `C-h m'
  145.      Display documentation of the current major mode (`describe-mode').
  146.  
  147. `C-h n'
  148.      Display documentation of Emacs changes, most recent first
  149.      (`view-emacs-news').
  150.  
  151. `C-h p'
  152.      Find packages by topic keyword (`finder-by-keyword').
  153.  
  154. `C-h s'
  155.      Display current contents of the syntax table, plus an explanation
  156.      of what they mean (`describe-syntax').  *Note Syntax::.
  157.  
  158. `C-h t'
  159.      Enter the Emacs interactive tutorial (`help-with-tutorial').
  160.  
  161. `C-h v VAR RET'
  162.      Display the documentation of the Lisp variable VAR
  163.      (`describe-variable').
  164.  
  165. `C-h w COMMAND RET'
  166.      Print which keys run the command named COMMAND (`where-is').
  167.  
  168. `C-h C-f FUNCTION RET'
  169.      Enter Info and go to the node documenting the Emacs function
  170.      FUNCTION (`Info-goto-emacs-command-node').
  171.  
  172. `C-h C-k KEY'
  173.      Enter Info and go to the node where the key sequence KEY is
  174.      documented (`Info-goto-emacs-key-command-node').
  175.  
  176. `C-h C-c'
  177.      Display the copying conditions for GNU Emacs.
  178.  
  179. `C-h C-d'
  180.      Display information about getting new versions of GNU Emacs.
  181.  
  182. `C-h C-p'
  183.      Display information about the GNU Project.
  184.  
  185. 
  186. File: emacs,  Node: Key Help,  Next: Name Help,  Prev: Help Summary,  Up: Help
  187.  
  188. Documentation for a Key
  189. =======================
  190.  
  191.    The most basic `C-h' options are `C-h c' (`describe-key-briefly')
  192. and `C-h k' (`describe-key').  `C-h c KEY' prints in the echo area the
  193. name of the command that KEY is bound to.  For example, `C-h c C-f'
  194. prints `forward-char'.  Since command names are chosen to describe what
  195. the commands do, this is a good way to get a very brief description of
  196. what KEY does.
  197.  
  198.    `C-h k KEY' is similar but gives more information: it displays the
  199. documentation string of the command as well as its name.  This is too
  200. big for the echo area, so a window is used for the display.
  201.  
  202.    `C-h c' and `C-h k' work for any sort of key sequences, including
  203. function keys and mouse events.
  204.  
  205. 
  206. File: emacs,  Node: Name Help,  Next: Apropos,  Prev: Key Help,  Up: Help
  207.  
  208. Help by Command or Variable Name
  209. ================================
  210.  
  211.    `C-h f' (`describe-function') reads the name of a Lisp function
  212. using the minibuffer, then displays that function's documentation string
  213. in a window.  Since commands are Lisp functions, you can use this to get
  214. the documentation of a command that you know by name.  For example,
  215.  
  216.      C-h f auto-fill-mode RET
  217.  
  218. displays the documentation of `auto-fill-mode'.  This is the only way
  219. to get the documentation of a command that is not bound to any key (one
  220. which you would normally run using `M-x').
  221.  
  222.    `C-h f' is also useful for Lisp functions that you are planning to
  223. use in a Lisp program.  For example, if you have just written the
  224. expression `(make-vector len)' and want to check that you are using
  225. `make-vector' properly, type `C-h f make-vector RET'.  Because `C-h f'
  226. allows all function names, not just command names, you may find that
  227. some of your favorite abbreviations that work in `M-x' don't work in
  228. `C-h f'.  An abbreviation may be unique among command names yet fail to
  229. be unique when other function names are allowed.
  230.  
  231.    The function name for `C-h f' to describe has a default which is
  232. used if you type RET leaving the minibuffer empty.  The default is the
  233. function called by the innermost Lisp expression in the buffer around
  234. point, *provided* that is a valid, defined Lisp function name.  For
  235. example, if point is located following the text `(make-vector (car x)',
  236. the innermost list containing point is the one that starts with
  237. `(make-vector', so the default is to describe the function
  238. `make-vector'.
  239.  
  240.    `C-h f' is often useful just to verify that you have the right
  241. spelling for the function name.  If `C-h f' mentions a name from the
  242. buffer as the default, that name must be defined as a Lisp function.  If
  243. that is all you want to know, just type `C-g' to cancel the `C-h f'
  244. command, then go on editing.
  245.  
  246.    `C-h w COMMAND RET' tells you what keys are bound to COMMAND.  It
  247. prints a list of the keys in the echo area.  If it says the command is
  248. not on any key, you must use `M-x' to run it.  `C-h w' runs the command
  249. `where-is'.
  250.  
  251.    `C-h v' (`describe-variable') is like `C-h f' but describes Lisp
  252. variables instead of Lisp functions.  Its default is the Lisp symbol
  253. around or before point, but only if that is the name of a known Lisp
  254. variable.  *Note Variables::.
  255.  
  256. 
  257. File: emacs,  Node: Apropos,  Next: Library Keywords,  Prev: Name Help,  Up: Help
  258.  
  259. Apropos
  260. =======
  261.  
  262.    A more sophisticated sort of question to ask is, "What are the
  263. commands for working with files?"  To ask this question, type `C-h a
  264. file RET', which displays a list of all command names that contain
  265. `file', including `copy-file', `find-file', and so on.  With each
  266. command name appears a brief description of how to use the command, and
  267. what keys you can currently invoke it with.  For example, it would say
  268. that you can invoke `find-file' by typing `C-x C-f'.  The `a' in `C-h
  269. a' stands for `Apropos'; `C-h a' runs the command `apropos-command'.
  270. This command does not check user variables by default; specify a
  271. numeric argument if you want it to check them.
  272.  
  273.    Because `C-h a' looks only for functions whose names contain the
  274. string which you specify, you must use ingenuity in choosing the
  275. string.  If you are looking for commands for killing backwards and `C-h
  276. a kill-backwards RET' doesn't reveal any, don't give up.  Try just
  277. `kill', or just `backwards', or just `back'.  Be persistent.  Also note
  278. that you can use a regular expression as the argument, for more
  279. flexibility (*note Regexps::.).
  280.  
  281.    Here is a set of arguments to give to `C-h a' that covers many
  282. classes of Emacs commands, since there are strong conventions for naming
  283. the standard Emacs commands.  By giving you a feel for the naming
  284. conventions, this set should also serve to aid you in developing a
  285. technique for picking `apropos' strings.
  286.  
  287.      char, line, word, sentence, paragraph, region, page, sexp, list,
  288.      defun, rect, buffer, frame, window, face, file, dir, register,
  289.      mode, beginning, end, forward, backward, next, previous, up, down,
  290.      search, goto, kill, delete, mark, insert, yank, fill, indent,
  291.      case, change, set, what, list, find, view, describe, default.
  292.  
  293.    To list all Lisp symbols that contain a match for a regexp, not just
  294. the ones that are defined as commands, use the command `M-x apropos'
  295. instead of `C-h a'.  This command does not check key bindings by
  296. default; specify a numeric argument if you want it to check them.
  297.  
  298.    The `apropos-documentation' command is like `apropos' except that it
  299. searches documentation strings as well as symbol names for matches for
  300. the specified regular expression.
  301.  
  302.    The `apropos-value' command is like `apropos' except that it
  303. searches symbols' values for matches for the specified regular
  304. expression.  This command does not check function definitions or
  305. property lists by default; specify a numeric argument if you want it to
  306. check them.
  307.  
  308.    If you want more information about a function definition, variable or
  309. symbol property listed in the Apropos buffer, you can click on it with
  310. `Mouse-2' or move there and type RET.
  311.  
  312. 
  313. File: emacs,  Node: Library Keywords,  Next: Misc Help,  Prev: Apropos,  Up: Help
  314.  
  315. Keyword Search for Lisp Libraries
  316. =================================
  317.  
  318.    The `C-h p' command lets you search the standard Emacs Lisp
  319. libraries by topic keywords.  Here is a partial list of keywords you can
  320. use:
  321.  
  322. `abbrev'
  323.      Abbreviation handling, typing shortcuts, macros.
  324.  
  325. `bib'
  326.      Support for the bibliography processor `bib'.
  327.  
  328. `c'
  329.      C and C++ language support.
  330.  
  331. `calendar'
  332.      Calendar and time management support.
  333.  
  334. `comm'
  335.      Communications, networking, remote access to files.
  336.  
  337. `data'
  338.      Support for editing files of data.
  339.  
  340. `docs'
  341.      Support for Emacs documentation.
  342.  
  343. `emulations'
  344.      Emulations of other editors.
  345.  
  346. `extensions'
  347.      Emacs Lisp language extensions.
  348.  
  349. `faces'
  350.      Support for using faces (fonts and colors; *note Faces::.).
  351.  
  352. `frames'
  353.      Support for Emacs frames and window systems.
  354.  
  355. `games'
  356.      Games, jokes and amusements.
  357.  
  358. `hardware'
  359.      Support for interfacing with exotic hardware.
  360.  
  361. `help'
  362.      Support for on-line help systems.
  363.  
  364. `hypermedia'
  365.      Support for links within text, or other media types.
  366.  
  367. `i18n'
  368.      Internationalization and alternate character-set support.
  369.  
  370. `internal'
  371.      Code for Emacs internals, build process, defaults.
  372.  
  373. `languages'
  374.      Specialized modes for editing programming languages.
  375.  
  376. `lisp'
  377.      Support for using Lisp (including Emacs Lisp).
  378.  
  379. `local'
  380.      Libraries local to your site.
  381.  
  382. `maint'
  383.      Maintenance aids for the Emacs development group.
  384.  
  385. `mail'
  386.      Modes for electronic-mail handling.
  387.  
  388. `matching'
  389.      Searching and matching.
  390.  
  391. `news'
  392.      Support for netnews reading and posting.
  393.  
  394. `non-text'
  395.      Support for editing files that are not ordinary text.
  396.  
  397. `oop'
  398.      Support for object-oriented programming.
  399.  
  400. `outlines'
  401.      Hierarchical outlining.
  402.  
  403. `processes'
  404.      Process, subshell, compilation, and job control support.
  405.  
  406. `terminals'
  407.      Support for terminal types.
  408.  
  409. `tex'
  410.      Support for the TeX formatter.
  411.  
  412. `tools'
  413.      Programming tools.
  414.  
  415. `unix'
  416.      Front-ends/assistants for, or emulators of, Unix features.
  417.  
  418. `vms'
  419.      Support code for VMS.
  420.  
  421. `wp'
  422.      Word processing.
  423.  
  424. 
  425. File: emacs,  Node: Misc Help,  Prev: Library Keywords,  Up: Help
  426.  
  427. Other Help Commands
  428. ===================
  429.  
  430.    `C-h i' (`info') runs the Info program, which is used for browsing
  431. through structured documentation files.  The entire Emacs manual is
  432. available within Info.  Eventually all the documentation of the GNU
  433. system will be available.  Type `h' after entering Info to run a
  434. tutorial on using Info.
  435.  
  436.    There are two special help commands for accessing Emacs documentation
  437. through Info.  `C-h C-f FUNCTION RET' enters Info and goes straight to
  438. the documentation of the Emacs function FUNCTION.  `C-h C-k KEY' enters
  439. Info and goes straight to the documentation of the key KEY.  These two
  440. keys run the commands `Info-goto-emacs-command-node' and
  441. `Info-goto-emacs-key-command-node'.
  442.  
  443.    If something surprising happens, and you are not sure what commands
  444. you typed, use `C-h l' (`view-lossage').  `C-h l' prints the last 100
  445. command characters you typed in.  If you see commands that you don't
  446. know, you can use `C-h c' to find out what they do.
  447.  
  448.    Emacs has numerous major modes, each of which redefines a few keys
  449. and makes a few other changes in how editing works.  `C-h m'
  450. (`describe-mode') prints documentation on the current major mode, which
  451. normally describes all the commands that are changed in this mode.
  452.  
  453.    `C-h b' (`describe-bindings') and `C-h s' (`describe-syntax')
  454. present other information about the current Emacs mode.  `C-h b'
  455. displays a list of all the key bindings now in effect; the local
  456. bindings defined by the current minor modes first, then the local
  457. bindings defined by the current major mode, and finally the global
  458. bindings (*note Key Bindings::.).  `C-h s' displays the contents of the
  459. syntax table, with explanations of each character's syntax (*note
  460. Syntax::.).
  461.  
  462.    You can get a similar list for a particular prefix key by typing
  463. `C-h' after the prefix key.  (There are a few prefix keys for which
  464. this does not work--those that provide their own bindings for `C-h'.
  465. One of these is ESC, because `ESC C-h' is actually `C-M-h', which marks
  466. a defun.)
  467.  
  468.    The other `C-h' options display various files of useful information.
  469. `C-h C-w' displays the full details on the complete absence of
  470. warranty for GNU Emacs.  `C-h n' (`view-emacs-news') displays the file
  471. `emacs/etc/NEWS', which contains documentation on Emacs changes
  472. arranged chronologically.  `C-h t' (`help-with-tutorial') displays the
  473. learn-by-doing Emacs tutorial.  `C-h C-c' (`describe-copying') displays
  474. the file `emacs/etc/COPYING', which tells you the conditions you must
  475. obey in distributing copies of Emacs.  `C-h C-d'
  476. (`describe-distribution') displays the file `emacs/etc/DISTRIB', which
  477. tells you how you can order a copy of the latest version of Emacs.
  478. `C-h C-p' (`describe-project') displays general information about the
  479. GNU Project.
  480.  
  481. 
  482. File: emacs,  Node: Mark,  Next: Killing,  Prev: Help,  Up: Top
  483.  
  484. The Mark and the Region
  485. ***********************
  486.  
  487.    Many Emacs commands operate on an arbitrary contiguous part of the
  488. current buffer.  To specify the text for such a command to operate on,
  489. you set "the mark" at one end of it, and move point to the other end.
  490. The text between point and the mark is called "the region".  Emacs
  491. highlights the region whenever there is one, if you enable Transient
  492. Mark mode (*note Transient Mark::.).
  493.  
  494.    You can move point or the mark to adjust the boundaries of the
  495. region.  It doesn't matter which one is set first chronologically, or
  496. which one comes earlier in the text.  Once the mark has been set, it
  497. remains where you put it until you set it again at another place.  Each
  498. Emacs buffer has its own mark, so that when you return to a buffer that
  499. had been selected previously, it has the same mark it had before.
  500.  
  501.    Many commands that insert text, such as `C-y' (`yank') and `M-x
  502. insert-buffer', position point and the mark at opposite ends of the
  503. inserted text, so that the region contains the text just inserted.
  504.  
  505.    Aside from delimiting the region, the mark is also useful for
  506. remembering a spot that you may want to go back to.  To make this
  507. feature more useful, each buffer remembers 16 previous locations of the
  508. mark in the "mark ring".
  509.  
  510. * Menu:
  511.  
  512. * Setting Mark::    Commands to set the mark.
  513. * Transient Mark::    How to make Emacs highlight the region-
  514.               when there is one.
  515. * Using Region::    Summary of ways to operate on contents of the region.
  516. * Marking Objects::    Commands to put region around textual units.
  517. * Mark Ring::       Previous mark positions saved so you can go back there.
  518. * Global Mark Ring::    Previous mark positions in various buffers.
  519.  
  520. 
  521. File: emacs,  Node: Setting Mark,  Next: Transient Mark,  Up: Mark
  522.  
  523. Setting the Mark
  524. ================
  525.  
  526.    Here are some commands for setting the mark:
  527.  
  528. `C-SPC'
  529.      Set the mark where point is (`set-mark-command').
  530.  
  531. `C-@'
  532.      The same.
  533.  
  534. `C-x C-x'
  535.      Interchange mark and point (`exchange-point-and-mark').
  536.  
  537. `Drag-Mouse-1'
  538.      Set point and the mark around the text you drag across.
  539.  
  540. `Mouse-3'
  541.      Set the mark where point is, then move point to where you click
  542.      (`mouse-save-then-kill').
  543.  
  544.    For example, suppose you wish to convert part of the buffer to all
  545. upper-case, using the `C-x C-u' (`upcase-region') command which
  546. operates on the text in the region.  You can first go to the beginning
  547. of the text to be capitalized, type `C-SPC' to put the mark there, move
  548. to the end, and then type `C-x C-u'.  Or, you can set the mark at the
  549. end of the text, move to the beginning, and then type `C-x C-u'.
  550.  
  551.    The most common way to set the mark is with the `C-SPC' command
  552. (`set-mark-command').  This sets the mark where point is.  Then you can
  553. move point away, leaving the mark behind.
  554.  
  555.    There are two ways to set the mark with the mouse.  You can drag
  556. mouse button one across a range of text; that puts point where you
  557. release the mouse button, and sets the mark at the other end of that
  558. range.  Or you can click mouse button three, which sets the mark at
  559. point (like `C-SPC') and them moves point (like `Mouse-1').  Both of
  560. these methods copy the region into the kill ring in addition to setting
  561. the mark; that gives behavior consistent with other window-driven
  562. applications, but if you don't want to modify the kill ring, you must
  563. use keyboard commands to set the mark.  *Note Mouse Commands::.
  564.  
  565.    Ordinary terminals have only one cursor, so there is no way for Emacs
  566. to show you where the mark is located.  You have to remember.  The usual
  567. solution to this problem is to set the mark and then use it soon, before
  568. you forget where it is.  Alternatively, you can see where the mark is
  569. with the command `C-x C-x' (`exchange-point-and-mark') which puts the
  570. mark where point was and point where the mark was.  The extent of the
  571. region is unchanged, but the cursor and point are now at the previous
  572. position of the mark.  In Transient Mark mode, this command reactivates
  573. the mark.
  574.  
  575.    `C-x C-x' is also useful when you are satisfied with the position of
  576. point but want to move the mark; do `C-x C-x' to put point at that end
  577. of the region, and then move it.  A second use of `C-x C-x', if
  578. necessary, puts the mark at the new position with point back at its
  579. original position.
  580.  
  581.    There is no such character as `C-SPC' in ASCII; when you type SPC
  582. while holding down CTRL, what you get on most ordinary terminals is the
  583. character `C-@'.  This key is actually bound to `set-mark-command'.
  584. But unless you are unlucky enough to have a terminal where typing
  585. `C-SPC' does not produce `C-@', you might as well think of this
  586. character as `C-SPC'.  Under X, `C-SPC' is actually a distinct
  587. character, but its binding is still `set-mark-command'.
  588.  
  589. 
  590. File: emacs,  Node: Transient Mark,  Next: Using Region,  Prev: Setting Mark,  Up: Mark
  591.  
  592. Transient Mark Mode
  593. ===================
  594.  
  595.    Emacs can highlight the current region, using X Windows.  But
  596. normally it does not.  Why not?
  597.  
  598.    Highlighting the region doesn't work well ordinarily in Emacs,
  599. because once you have set a mark, there is *always* a region (in that
  600. buffer).  And highlighting the region all the time would be a nuisance.
  601.  
  602.    You can turn on region highlighting by enabling Transient Mark mode.
  603. This is a more rigid mode of operation in which the region "lasts" only
  604. temporarily, so you must set up a region for each command that uses
  605. one.  In Transient Mark mode, most of the time there is no region;
  606. therefore, highlighting the region when it exists is convenient.
  607.  
  608.    To enable Transient Mark mode, type `M-x transient-mark-mode'.  This
  609. command toggles the mode, so you can repeat the command to turn off the
  610. mode.
  611.  
  612.    Here are the details of Transient Mark mode:
  613.  
  614.    * To set the mark, type `C-SPC' (`set-mark-command').  This makes
  615.      the mark active; as you move point, you will see the region
  616.      highlighting change in extent.
  617.  
  618.    * The mouse commands for specifying the mark also make it active.
  619.      So do keyboard commands whose purpose is to specify a region,
  620.      including `M-@', `C-M-@', `M-h', `C-M-h', `C-x C-p', and `C-x h'.
  621.  
  622.    * When the mark is active, you can execute commands that operate on
  623.      the region, such as killing, indentation, or writing to a file.
  624.  
  625.    * Any change to the buffer, such as inserting or deleting a
  626.      character, deactivates the mark.  This means any subsequent
  627.      command that operates on a region will get an error and refuse to
  628.      operate.  You can make the region active again by typing `C-x C-x'.
  629.  
  630.    * Commands like `M->' and `C-s' that "leave the mark behind" in
  631.      addition to some other primary purpose do not activate the new
  632.      mark.  You can activate the new region by executing `C-x C-x'
  633.      (`exchange-point-and-mark').
  634.  
  635.    * `C-s' when the mark is active does not alter the mark.
  636.  
  637.    * Quitting with `C-g' deactivates the mark.
  638.  
  639.    Transient Mark mode is also sometimes known as "Zmacs mode" because
  640. the Zmacs editor on the MIT Lisp Machine handled the mark in a similar
  641. way.
  642.  
  643.    When multiple windows show the same buffer, they can have different
  644. regions, because they can have different values of point (though they
  645. all share common one mark position).  In Transient Mark mode, each
  646. window highlights its own region.  The part that is highlighted in the
  647. selected window is the region that editing commands use.  *Note
  648. Windows::.
  649.  
  650.    When Transient Mark mode is not enabled, every command that sets the
  651. mark also activates it, and nothing ever deactivates it.
  652.  
  653.    If the variable `mark-even-if-inactive' is non-`nil' in Transient
  654. Mark mode, then commands can use the mark and the region even when it
  655. is inactive.  Region highlighting appears and disappears just as it
  656. normally does in Transient Mark mode, but the mark doesn't really go
  657. away when the highlighting disappears.
  658.  
  659. 
  660. File: emacs,  Node: Using Region,  Next: Marking Objects,  Prev: Transient Mark,  Up: Mark
  661.  
  662. Operating on the Region
  663. =======================
  664.  
  665.    Once you have a region and the mark is active, here are some of the
  666. ways you can operate on the region:
  667.  
  668.    * Kill it with `C-w' (*note Killing::.).
  669.  
  670.    * Save it in a register with `C-x r s' (*note Registers::.).
  671.  
  672.    * Save it in a buffer or a file (*note Accumulating Text::.).
  673.  
  674.    * Convert case with `C-x C-l' or `C-x C-u' (*note Case::.).
  675.  
  676.    * Indent it with `C-x TAB' or `C-M-\' (*note Indentation::.).
  677.  
  678.    * Fill it as text with `M-x fill-region' (*note Filling::.).
  679.  
  680.    * Print hardcopy with `M-x print-region' (*note Hardcopy::.).
  681.  
  682.    * Evaluate it as Lisp code with `M-x eval-region' (*note Lisp
  683.      Eval::.).
  684.  
  685.    Most commands that operate on the text in the region have the word
  686. `region' in their names.
  687.  
  688. 
  689. File: emacs,  Node: Marking Objects,  Next: Mark Ring,  Prev: Using Region,  Up: Mark
  690.  
  691. Commands to Mark Textual Objects
  692. ================================
  693.  
  694.    Here are the commands for placing point and the mark around a textual
  695. object such as a word, list, paragraph or page.
  696.  
  697. `M-@'
  698.      Set mark after end of next word (`mark-word').  This command and
  699.      the following one do not move point.
  700.  
  701. `C-M-@'
  702.      Set mark after end of next Lisp expression (`mark-sexp').
  703.  
  704. `M-h'
  705.      Put region around current paragraph (`mark-paragraph').
  706.  
  707. `C-M-h'
  708.      Put region around current Lisp defun (`mark-defun').
  709.  
  710. `C-x h'
  711.      Put region around entire buffer (`mark-whole-buffer').
  712.  
  713. `C-x C-p'
  714.      Put region around current page (`mark-page').
  715.  
  716.    `M-@' (`mark-word') puts the mark at the end of the next word, while
  717. `C-M-@' (`mark-sexp') puts it at the end of the next Lisp expression.
  718. These commands handle arguments just like `M-f' and `C-M-f'.
  719.  
  720.    Other commands set both point and mark, to delimit an object in the
  721. buffer.  For example, `M-h' (`mark-paragraph') moves point to the
  722. beginning of the paragraph that surrounds or follows point, and puts
  723. the mark at the end of that paragraph (*note Paragraphs::.).  It
  724. prepares the region so you can indent, case-convert, or kill a whole
  725. paragraph.
  726.  
  727.    `C-M-h' (`mark-defun') similarly puts point before and the mark
  728. after the current or following defun (*note Defuns::.).  `C-x C-p'
  729. (`mark-page') puts point before the current page, and mark at the end
  730. (*note Pages::.).  The mark goes after the terminating page delimiter
  731. (to include it), while point goes after the preceding page delimiter
  732. (to exclude it).  A numeric argument specifies a later page (if
  733. positive) or an earlier page (if negative) instead of the current page.
  734.  
  735.    Finally, `C-x h' (`mark-whole-buffer') sets up the entire buffer as
  736. the region, by putting point at the beginning and the mark at the end.
  737.  
  738.    In Transient Mark mode, all of these commands activate the mark.
  739.  
  740. 
  741. File: emacs,  Node: Mark Ring,  Next: Global Mark Ring,  Prev: Marking Objects,  Up: Mark
  742.  
  743. The Mark Ring
  744. =============
  745.  
  746.    Aside from delimiting the region, the mark is also useful for
  747. remembering a spot that you may want to go back to.  To make this
  748. feature more useful, each buffer remembers 16 previous locations of the
  749. mark, in the "mark ring".  Commands that set the mark also push the old
  750. mark onto this ring.  To return to a marked location, use `C-u C-SPC'
  751. (or `C-u C-@'); this is the command `set-mark-command' given a numeric
  752. argument.  It moves point to where the mark was, and restores the mark
  753. from the ring of former marks.  Thus, repeated use of this command
  754. moves point to all of the old marks on the ring, one by one.  The mark
  755. positions you move through in this way are not lost; they go to the end
  756. of the ring.
  757.  
  758.    Each buffer has its own mark ring.  All editing commands use the
  759. current buffer's mark ring.  In particular, `C-u C-SPC' always stays in
  760. the same buffer.
  761.  
  762.    Many commands that can move long distances, such as `M-<'
  763. (`beginning-of-buffer'), start by setting the mark and saving the old
  764. mark on the mark ring.  This is to make it easier for you to move back
  765. later.  Searches set the mark if they move point.  You can tell when a
  766. command sets the mark because it displays `Mark Set' in the echo area.
  767.  
  768.    If you want to move back to the same place over and over, the mark
  769. ring may not be convenient enough.  If so, you can record the position
  770. in a register for later retrieval (*note RegPos::.).
  771.  
  772.    The variable `mark-ring-max' specifies the maximum number of entries
  773. to keep in the mark ring.  If that many entries exist and another one
  774. is pushed, the last one in the list is discarded.  Repeating `C-u
  775. C-SPC' circulates through the positions currently in the ring.
  776.  
  777.    The variable `mark-ring' holds the mark ring itself, as a list of
  778. marker objects in the order most recent first.  This variable is local
  779. in every buffer.
  780.  
  781. 
  782. File: emacs,  Node: Global Mark Ring,  Prev: Mark Ring,  Up: Mark
  783.  
  784. The Global Mark Ring
  785. ====================
  786.  
  787.    In addition to the ordinary mark ring that belongs to each buffer,
  788. Emacs has a single "global mark ring".  It records a sequence of
  789. buffers in which you have recently set the mark, so you can go back to
  790. those buffers.
  791.  
  792.    Setting the mark always makes an entry on the current buffer's mark
  793. ring.  If you have switched buffers since the previous mark setting, the
  794. new mark position makes an entry on the global mark ring also.  The
  795. result is that the global mark ring records a sequence of buffers that
  796. you have been in, and, for each buffer, a place where you set the mark.
  797.  
  798.    The command `C-x C-SPC' (`pop-global-mark') jumps to the buffer and
  799. position of the latest entry in the global ring.  It also rotates the
  800. ring, so that successive uses of `C-x C-SPC' take you to earlier and
  801. earlier buffers.
  802.  
  803. 
  804. File: emacs,  Node: Killing,  Next: Yanking,  Prev: Mark,  Up: Top
  805.  
  806. Deletion and Killing
  807. ====================
  808.  
  809.    Most commands which erase text from the buffer save it in the kill
  810. ring so that you can move or copy it to other parts of the buffer.
  811. These commands are known as "kill" commands.  The rest of the commands
  812. that erase text do not save it in the kill ring; they are known as
  813. "delete" commands.  (This distinction is made only for erasure of text
  814. in the buffer.)  If you do a kill or delete command by mistake, you can
  815. use the `C-x u' (`undo') command to undo it (*note Undo::.).
  816.  
  817.    The delete commands include `C-d' (`delete-char') and DEL
  818. (`delete-backward-char'), which delete only one character at a time,
  819. and those commands that delete only spaces or newlines.  Commands that
  820. can destroy significant amounts of nontrivial data generally kill.  The
  821. commands' names and individual descriptions use the words `kill' and
  822. `delete' to say which they do.
  823.  
  824. * Menu:
  825.  
  826. * Deletion::            Commands for deleting small amounts of text and
  827.                           blank areas.
  828. * Killing by Lines::    How to kill entire lines of text at one time.
  829. * Other Kill Commands:: Commands to kill large regions of text and
  830.                           syntactic units such as words and sentences.
  831.  
  832. 
  833. File: emacs,  Node: Deletion,  Next: Killing by Lines,  Up: Killing
  834.  
  835. Deletion
  836. --------
  837.  
  838. `C-d'
  839.      Delete next character (`delete-char').
  840.  
  841. `DEL'
  842.      Delete previous character (`delete-backward-char').
  843.  
  844. `M-\'
  845.      Delete spaces and tabs around point (`delete-horizontal-space').
  846.  
  847. `M-SPC'
  848.      Delete spaces and tabs around point, leaving one space
  849.      (`just-one-space').
  850.  
  851. `C-x C-o'
  852.      Delete blank lines around the current line (`delete-blank-lines').
  853.  
  854. `M-^'
  855.      Join two lines by deleting the intervening newline, along with any
  856.      indentation following it (`delete-indentation').
  857.  
  858.    The most basic delete commands are `C-d' (`delete-char') and DEL
  859. (`delete-backward-char').  `C-d' deletes the character after point, the
  860. one the cursor is "on top of".  This doesn't move point.  DEL deletes
  861. the character before the cursor, and moves point back.  You can delete
  862. newlines like any other characters in the buffer; deleting a newline
  863. joins two lines.  Actually, `C-d' and DEL aren't always delete
  864. commands; when given arguments, they kill instead, since they can erase
  865. more than one character this way.
  866.  
  867.    The other delete commands are those which delete only whitespace
  868. characters: spaces, tabs and newlines.  `M-\'
  869. (`delete-horizontal-space') deletes all the spaces and tab characters
  870. before and after point.  `M-SPC' (`just-one-space') does likewise but
  871. leaves a single space after point, regardless of the number of spaces
  872. that existed previously (even zero).
  873.  
  874.    `C-x C-o' (`delete-blank-lines') deletes all blank lines after the
  875. current line.  If the current line is blank, it deletes all blank lines
  876. preceding the current line as well (leaving one blank line, the current
  877. line).
  878.  
  879.    `M-^' (`delete-indentation') joins the current line and the previous
  880. line, by deleting a newline and all surrounding spaces, usually leaving
  881. a single space.  *Note M-^: Indentation.
  882.  
  883. 
  884. File: emacs,  Node: Killing by Lines,  Next: Other Kill Commands,  Prev: Deletion,  Up: Killing
  885.  
  886. Killing by Lines
  887. ----------------
  888.  
  889. `C-k'
  890.      Kill rest of line or one or more lines (`kill-line').
  891.  
  892.    The simplest kill command is `C-k'.  If given at the beginning of a
  893. line, it kills all the text on the line, leaving it blank.  When used
  894. on a blank line, it kills the whole line including its newline.  To kill
  895. an entire non-blank line, go to the beginning and type `C-k' twice.
  896.  
  897.    More generally, `C-k' kills from point up to the end of the line,
  898. unless it is at the end of a line.  In that case it kills the newline
  899. following point, thus merging the next line into the current one.
  900. Spaces and tabs that you can't see at the end of the line are ignored
  901. when deciding which case applies, so if point appears to be at the end
  902. of the line, you can be sure `C-k' will kill the newline.
  903.  
  904.    When `C-k' is given a positive argument, it kills that many lines
  905. and the newlines that follow them (however, text on the current line
  906. before point is spared).  With a negative argument -N, it kills N lines
  907. preceding the current line (together with the text on the current line
  908. before point).  Thus, `C-u - 2 C-k' at the front of a line kills the
  909. two previous lines.
  910.  
  911.    `C-k' with an argument of zero kills the text before point on the
  912. current line.
  913.  
  914.    If the variable `kill-whole-line' is non-`nil', `C-k' at the very
  915. beginning of a line kills the entire line including the following
  916. newline.  This variable is normally `nil'.
  917.  
  918. 
  919. File: emacs,  Node: Other Kill Commands,  Prev: Killing by Lines,  Up: Killing
  920.  
  921. Other Kill Commands
  922. -------------------
  923.  
  924. `C-w'
  925.      Kill region (from point to the mark) (`kill-region').
  926.  
  927. `M-d'
  928.      Kill word (`kill-word').  *Note Words::.
  929.  
  930. `M-DEL'
  931.      Kill word backwards (`backward-kill-word').
  932.  
  933. `C-x DEL'
  934.      Kill back to beginning of sentence (`backward-kill-sentence').
  935.      *Note Sentences::.
  936.  
  937. `M-k'
  938.      Kill to end of sentence (`kill-sentence').
  939.  
  940. `C-M-k'
  941.      Kill sexp (`kill-sexp').  *Note Lists::.
  942.  
  943. `M-z CHAR'
  944.      Kill through the next occurrence of CHAR (`zap-to-char').
  945.  
  946.    A kill command which is very general is `C-w' (`kill-region'), which
  947. kills everything between point and the mark.  With this command, you
  948. can kill any contiguous sequence of characters, if you first set the
  949. region around them.
  950.  
  951.    A convenient way of killing is combined with searching: `M-z'
  952. (`zap-to-char') reads a character and kills from point up to (and
  953. including) the next occurrence of that character in the buffer.  A
  954. numeric argument acts as a repeat count.  A negative argument means to
  955. search backward and kill text before point.
  956.  
  957.    Other syntactic units can be killed: words, with `M-DEL' and `M-d'
  958. (*note Words::.); sexps, with `C-M-k' (*note Lists::.); and sentences,
  959. with `C-x DEL' and `M-k' (*note Sentences::.).
  960.  
  961.    You can use kill commands in read-only buffers.  They don't actually
  962. change the buffer, and they beep to warn you of that, but they do copy
  963. the text you tried to kill into the kill ring, so you can yank it into
  964. other buffers.  Most of the kill commands move point across the text
  965. they copy in this way, so that successive kill commands build up a
  966. single kill ring entry as usual.
  967.  
  968. 
  969. File: emacs,  Node: Yanking,  Next: Accumulating Text,  Prev: Killing,  Up: Top
  970.  
  971. Yanking
  972. =======
  973.  
  974.    "Yanking" means reinserting text previously killed.  This is what
  975. some systems call "pasting".  The usual way to move or copy text is to
  976. kill it and then yank it elsewhere one or more times.
  977.  
  978. `C-y'
  979.      Yank last killed text (`yank').
  980.  
  981. `M-y'
  982.      Replace text just yanked with an earlier batch of killed text
  983.      (`yank-pop').
  984.  
  985. `M-w'
  986.      Save region as last killed text without actually killing it
  987.      (`kill-ring-save').
  988.  
  989. `C-M-w'
  990.      Append next kill to last batch of killed text (`append-next-kill').
  991.  
  992. * Menu:
  993.  
  994. * Kill Ring::        Where killed text is stored.  Basic yanking.
  995. * Appending Kills::    Several kills in a row all yank together.
  996. * Earlier Kills::    Yanking something killed some time ago.
  997.  
  998. 
  999. File: emacs,  Node: Kill Ring,  Next: Appending Kills,  Up: Yanking
  1000.  
  1001. The Kill Ring
  1002. -------------
  1003.  
  1004.    All killed text is recorded in the "kill ring", a list of blocks of
  1005. text that have been killed.  There is only one kill ring, shared by all
  1006. buffers, so you can kill text in one buffer and yank it in another
  1007. buffer.  This is the usual way to move text from one file to another.
  1008. (*Note Accumulating Text::, for some other ways.)
  1009.  
  1010.    The command `C-y' (`yank') reinserts the text of the most recent
  1011. kill.  It leaves the cursor at the end of the text.  It sets the mark at
  1012. the beginning of the text.  *Note Mark::.
  1013.  
  1014.    `C-u C-y' leaves the cursor in front of the text, and sets the mark
  1015. after it.  This happens only if the argument is specified with just a
  1016. `C-u', precisely.  Any other sort of argument, including `C-u' and
  1017. digits, specifies an earlier kill to yank (*note Earlier Kills::.).
  1018.  
  1019.    To copy a block of text, you can use `M-w' (`kill-ring-save'), which
  1020. copies the region into the kill ring without removing it from the
  1021. buffer.  This is approximately equivalent to `C-w' followed by `C-x u',
  1022. except that `M-w' does not alter the undo history and does not
  1023. temporarily change the screen.
  1024.  
  1025. 
  1026. File: emacs,  Node: Appending Kills,  Next: Earlier Kills,  Prev: Kill Ring,  Up: Yanking
  1027.  
  1028. Appending Kills
  1029. ---------------
  1030.  
  1031.    Normally, each kill command pushes a new entry onto the kill ring.
  1032. However, two or more kill commands in a row combine their text into a
  1033. single entry, so that a single `C-y' yanks all the text as a unit, just
  1034. as it was before it was killed.
  1035.  
  1036.    Thus, if you want to yank text as a unit, you need not kill all of it
  1037. with one command; you can keep killing line after line, or word after
  1038. word, until you have killed it all, and you can still get it all back at
  1039. once.
  1040.  
  1041.    Commands that kill forward from point add onto the end of the
  1042. previous killed text.  Commands that kill backward from point add text
  1043. onto the beginning.  This way, any sequence of mixed forward and
  1044. backward kill commands puts all the killed text into one entry without
  1045. rearrangement.  Numeric arguments do not break the sequence of
  1046. appending kills.  For example, suppose the buffer contains this text:
  1047.  
  1048.      This is a line -!-of sample text.
  1049.  
  1050. with point shown by -!-.  If you type `M-d M-DEL M-d M-DEL', killing
  1051. alternately forward and backward, you end up with `a line of sample' as
  1052. one entry in the kill ring, and `This is  text.' in the buffer.  (Note
  1053. the double space, which you can clean up with `M-SPC' or `M-q'.)
  1054.  
  1055.    Another way to kill the same text is to move back two words with
  1056. `M-b M-b', then kill all four words forward with `C-u M-d'.  This
  1057. produces exactly the same results in the buffer and in the kill ring.
  1058. `M-f M-f C-u M-DEL' kills the same text, all going backward; once
  1059. again, the result is the same.  The text in the kill ring entry always
  1060. has the same order that it had in the buffer before you killed it.
  1061.  
  1062.    If a kill command is separated from the last kill command by other
  1063. commands (not just numeric arguments), it starts a new entry on the kill
  1064. ring.  But you can force it to append by first typing the command
  1065. `C-M-w' (`append-next-kill') right before it.  The `C-M-w' tells the
  1066. following command, if it is a kill command, to append the text it kills
  1067. to the last killed text, instead of starting a new entry.  With
  1068. `C-M-w', you can kill several separated pieces of text and accumulate
  1069. them to be yanked back in one place.
  1070.  
  1071.    A kill command following `M-w' does not append to the text that
  1072. `M-w' copied into the kill ring.
  1073.  
  1074. 
  1075. File: emacs,  Node: Earlier Kills,  Prev: Appending Kills,  Up: Yanking
  1076.  
  1077. Yanking Earlier Kills
  1078. ---------------------
  1079.  
  1080.    To recover killed text that is no longer the most recent kill, use
  1081. the `M-y' command (`yank-pop').  It takes the text previously yanked
  1082. and replaces it with the text from an earlier kill.  So, to recover the
  1083. text of the next-to-the-last kill, first use `C-y' to yank the last
  1084. kill, and then use `M-y' to replace it with the previous kill.  `M-y'
  1085. is allowed only after a `C-y' or another `M-y'.
  1086.  
  1087.    You can understand `M-y' in terms of a "last yank" pointer which
  1088. points at an entry in the kill ring.  Each time you kill, the "last
  1089. yank" pointer moves to the newly made entry at the front of the ring.
  1090. `C-y' yanks the entry which the "last yank" pointer points to.  `M-y'
  1091. moves the "last yank" pointer to a different entry, and the text in the
  1092. buffer changes to match.  Enough `M-y' commands can move the pointer to
  1093. any entry in the ring, so you can get any entry into the buffer.
  1094. Eventually the pointer reaches the end of the ring; the next `M-y'
  1095. moves it to the first entry again.
  1096.  
  1097.    `M-y' moves the "last yank" pointer around the ring, but it does not
  1098. change the order of the entries in the ring, which always runs from the
  1099. most recent kill at the front to the oldest one still remembered.
  1100.  
  1101.    `M-y' can take a numeric argument, which tells it how many entries
  1102. to advance the "last yank" pointer by.  A negative argument moves the
  1103. pointer toward the front of the ring; from the front of the ring, it
  1104. moves "around" to the last entry and continues forward from there.
  1105.  
  1106.    Once the text you are looking for is brought into the buffer, you can
  1107. stop doing `M-y' commands and it will stay there.  It's just a copy of
  1108. the kill ring entry, so editing it in the buffer does not change what's
  1109. in the ring.  As long as no new killing is done, the "last yank"
  1110. pointer remains at the same place in the kill ring, so repeating `C-y'
  1111. will yank another copy of the same previous kill.
  1112.  
  1113.    If you know how many `M-y' commands it would take to find the text
  1114. you want, you can yank that text in one step using `C-y' with a numeric
  1115. argument.  `C-y' with an argument restores the text the specified
  1116. number of entries back in the kill ring.  Thus, `C-u 2 C-y' gets the
  1117. next to the last block of killed text.  It is equivalent to `C-y M-y'.
  1118. `C-y' with a numeric argument starts counting from the "last yank"
  1119. pointer, and sets the "last yank" pointer to the entry that it yanks.
  1120.  
  1121.    The length of the kill ring is controlled by the variable
  1122. `kill-ring-max'; no more than that many blocks of killed text are saved.
  1123.  
  1124.    The actual contents of the kill ring are stored in a variable named
  1125. `kill-ring'; you can view the entire contents of the kill ring with the
  1126. command `C-h v kill-ring'.
  1127.  
  1128. 
  1129. File: emacs,  Node: Accumulating Text,  Next: Rectangles,  Prev: Yanking,  Up: Top
  1130.  
  1131. Accumulating Text
  1132. =================
  1133.  
  1134.    Usually we copy or move text by killing it and yanking it, but there
  1135. are other methods convenient for copying one block of text in many
  1136. places, or for copying many scattered blocks of text into one place.  To
  1137. copy one block to many places, store it in a register (*note
  1138. Registers::.).  Here we describe the commands to accumulate scattered
  1139. pieces of text into a buffer or into a file.
  1140.  
  1141. `M-x append-to-buffer'
  1142.      Append region to contents of specified buffer.
  1143.  
  1144. `M-x prepend-to-buffer'
  1145.      Prepend region to contents of specified buffer.
  1146.  
  1147. `M-x copy-to-buffer'
  1148.      Copy region into specified buffer, deleting that buffer's old
  1149.      contents.
  1150.  
  1151. `M-x insert-buffer'
  1152.      Insert contents of specified buffer into current buffer at point.
  1153.  
  1154. `M-x append-to-file'
  1155.      Append region to contents of specified file, at the end.
  1156.  
  1157.    To accumulate text into a buffer, use `M-x append-to-buffer'.  This
  1158. reads a buffer name, them inserts a copy of the region into the buffer
  1159. specified.  If you specify a nonexistent buffer, `append-to-buffer'
  1160. creates the buffer.  The text is inserted wherever point is in that
  1161. buffer.  If you have been using the buffer for editing, the copied text
  1162. goes into the middle of the text of the buffer, wherever point happens
  1163. to be in it.
  1164.  
  1165.    Point in that buffer is left at the end of the copied text, so
  1166. successive uses of `append-to-buffer' accumulate the text in the
  1167. specified buffer in the same order as they were copied.  Strictly
  1168. speaking, `append-to-buffer' does not always append to the text already
  1169. in the buffer--only if point in that buffer is at the end.  However, if
  1170. `append-to-buffer' is the only command you use to alter a buffer, then
  1171. point is always at the end.
  1172.  
  1173.    `M-x prepend-to-buffer' is just like `append-to-buffer' except that
  1174. point in the other buffer is left before the copied text, so successive
  1175. prependings add text in reverse order.  `M-x copy-to-buffer' is similar
  1176. except that any existing text in the other buffer is deleted, so the
  1177. buffer is left containing just the text newly copied into it.
  1178.  
  1179.    To retrieve the accumulated text from another buffer, use `M-x
  1180. insert-buffer'; this too takes BUFFERNAME as an argument.  It inserts a
  1181. copy of the text in buffer BUFFERNAME into the selected buffer.  You
  1182. can alternatively select the other buffer for editing, then optionally
  1183. move text from it by killing.  *Note Buffers::, for background
  1184. information on buffers.
  1185.  
  1186.    Instead of accumulating text within Emacs, in a buffer, you can
  1187. append text directly into a file with `M-x append-to-file', which takes
  1188. FILENAME as an argument.  It adds the text of the region to the end of
  1189. the specified file.  The file is changed immediately on disk.
  1190.  
  1191.    You should use `append-to-file' only with files that are *not* being
  1192. visited in Emacs.  Using it on a file that you are editing in Emacs
  1193. would change the file behind Emacs's back, which can lead to losing
  1194. some of your editing.
  1195.  
  1196.